export PYTHONPATH=./:$PYTHONPATH
dir=./output_python
mkdir -p $dir
decoding_chunk_size=
lm_scale=0.7
decoder_scale=0.1
r_decoder_scale=0.7
ctc_weight=0.5
decode_modes="attention_rescoring"
gpu_id=0
data_type=raw
echo '耿雪龙： 开始python推理'
test_data_dir="/home/work_nfs8/xlgeng/data/scp_test"
test_sets=( "aishell" "mix_asru" "aishell2" "speechio_0" "speechio_1" "speechio_2" "speechio_3" "speechio_4" "test_meeting" "test_net" )
pt_path=/home/work_nfs7/yhdai/workspace/online_sys/wenet/examples/onlinesys/exp/final_work_stage7/avg.pt
config_path=/home/work_nfs8/xlgeng/new_workspace/gxl_ai_utils/eggs/cats_and_dogs/ngram_task/inference/config/train.yaml
for test_set in "${test_sets[@]}"; do
  result_dir=$dir/${test_set}
  python wenet/bin/recognize.py --gpu $gpu_id \
    --modes $decode_modes \
    --config $config_path \
    --data_type $data_type \
    --test_data $test_data_dir/"$test_set"/data.list \
    --checkpoint $pt_path \
    --beam_size 10 \
    --batch_size 16 \
    --blank_penalty 0.0 \
    --result_dir "$result_dir" \
    --ctc_weight $ctc_weight \
    --lm_scale $lm_scale \
    --decoder_scale $decoder_scale \
    --r_decoder_scale $r_decoder_scale \
    ${decoding_chunk_size:+--decoding_chunk_size $decoding_chunk_size}
  for mode in $decode_modes; do
    test_dir=$result_dir/$mode
    python tools/compute-wer.py --char=1 --v=1 \
      $test_data_dir/"$test_set"/text "$test_dir"/text > "$test_dir"/wer
  done
done